home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Boss - 99 Games / Powersource Multimedia - Windows Game Boss 99 Games.iso / game1.pas < prev    next >
Pascal/Delphi Source File  |  1995-12-25  |  4KB  |  167 lines

  1. unit Game1;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, Buttons, ExtCtrls, MPlayer,abo;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     ListBox1: TListBox;
  12.     ListBox2: TListBox;
  13.     OpenDialog1: TOpenDialog;
  14.     Image1: TImage;
  15.     Timer1: TTimer;
  16.     ListBox3: TListBox;
  17.     MediaPlayer1: TMediaPlayer;
  18.     ListBox4: TListBox;
  19.     Image2: TImage;
  20.     Label1: TLabel;
  21.     SpeedButton1: TSpeedButton;
  22.     Image3: TImage;
  23.     Label2: TLabel;
  24.     procedure ListBox1Click(Sender: TObject);
  25.     procedure FormCreate(Sender: TObject);
  26.     procedure Timer1Timer(Sender: TObject);
  27.     procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
  28.       Y: Integer);
  29.     procedure Image2MouseMove(Sender: TObject; Shift: TShiftState; X,
  30.       Y: Integer);
  31.     procedure SpeedButton1Click(Sender: TObject);
  32.     procedure Image3Click(Sender: TObject);
  33.     procedure SpeedButton1MouseMove(Sender: TObject; Shift: TShiftState; X,
  34.       Y: Integer);
  35.   private
  36.     { Private declarations }
  37.   public
  38.     { Public declarations }
  39.   end;
  40.   hi=record
  41.    na:string;
  42.   end;
  43.  
  44. var
  45.   Form1: TForm1;
  46.   f:File of hi;
  47.   tf :TextFile;
  48.   re:hi;
  49.   cmd:array[0..255] of char;
  50.   st,DIRE:String;
  51.   i,star:integer;
  52.   p:Boolean;
  53.  
  54. implementation
  55.  
  56. {$R *.DFM}
  57.  
  58. procedure TForm1.ListBox1Click(Sender: TObject);
  59. begin
  60.      For i:=0 to 95 do
  61.      if listbox1.selected[i] then
  62.      begin
  63.      p:=false;
  64.      mediaplayer1.stop;
  65.      chdir(DIRE+listbox4.items[i]);
  66.      strpcopy(cmd,DIRE+listbox2.items[i]);
  67.      winexec(cmd,sw_showmaximized);
  68.      end;
  69. end;
  70.  
  71. procedure TForm1.FormCreate(Sender: TObject);
  72. VAR
  73.    sEARCHrEC:tsEARCHrEC;
  74. begin
  75.      dire:='d:';
  76.     if FindFirst(dire+'\GAME.exe', faAnyFile, SearchRec)<>0 then
  77.     While FindFirst(dire+'\GAME.exe', faAnyFile, SearchRec)<>0 do
  78.           begin
  79.           Findclose(SearchRec);
  80.           if inputquery('File error','Please enter new path for GAME.exe',dire)=false
  81.              then halt;
  82.           End;
  83. {     assignfile(tf,'c:\point.txt');
  84.      rewrite(tf);
  85.      writeln(tf,intToStr(listbox1.top)+',,'+intToStr(listbox1.left));
  86.      writeln(tf,intToStr(image2.top)+',,'+intToStr(image2.left));
  87.      writeln(tf,intToStr(label1.top)+',,'+intToStr(label1.left));
  88.      writeln(tf,intToStr(label2.top)+',,'+intToStr(label2.left));
  89.      writeln(tf,intToStr(image3.top)+',,'+intToStr(image3.left));
  90.      writeln(tf,intToStr(speedbutton1.top)+',,'+intToStr(speedbutton1.left));
  91.      closefile(tf);
  92.      halt;}
  93.      if image1.width=800 then
  94.      begin
  95.      listbox1.top:=192;
  96.      listbox1.left:=265;
  97.      image2.top:=57;
  98.      image2.left:=80;
  99.      label1.top:=117;
  100.      label1.left:=212;
  101.      label2.top:=160;
  102.      label2.left:=490;
  103.      image3.top:=480;
  104.      image3.left:=184;
  105.      speedbutton1.top:=152;
  106.      speedbutton1.left:=472;
  107.      end;
  108.      with mediaplayer1 do
  109.      begin
  110.           filename:=DIRE+'\GAMES\acres.mid';
  111.           open;
  112.           play;
  113.           p:=true;
  114.      end;
  115. end;
  116.  
  117. procedure TForm1.Timer1Timer(Sender: TObject);
  118. begin
  119.      if p then
  120.      with mediaplayer1 do
  121.      if position=tracklength[1] then
  122.      begin
  123.           star:=star+1;
  124.           filename:=DIRE+listbox3.items[star];
  125.           open;
  126.           play;
  127.           if star=3 then star:=-1;
  128.      end;
  129. end;
  130.  
  131. procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
  132.   Y: Integer);
  133. begin
  134.      label1.visible:=false;
  135.      label2.visible:=false;
  136.      if p=false then
  137.      begin
  138.      mediaplayer1.play;
  139.      p:=true;
  140.      end;
  141. end;
  142.  
  143. procedure TForm1.Image2MouseMove(Sender: TObject; Shift: TShiftState; X,
  144.   Y: Integer);
  145. begin
  146.      label1.visible:=true;
  147.      label1.caption:=TimeToStr(Time);
  148. end;
  149.  
  150. procedure TForm1.SpeedButton1Click(Sender: TObject);
  151. begin
  152.      close;
  153. end;
  154.  
  155. procedure TForm1.Image3Click(Sender: TObject);
  156. begin
  157.      AboutBox.showmodal;
  158. end;
  159.  
  160. procedure TForm1.SpeedButton1MouseMove(Sender: TObject; Shift: TShiftState;
  161.   X, Y: Integer);
  162. begin
  163.      label2.visible:=true;
  164. end;
  165.  
  166. end.
  167.